<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .box {
        position: absolute;
        left: 50%;
        top: 50%;
        /* margin-left: -150px;
        margin-top: -150px; */
        /* 利用：translate进行水平移动自己宽高的一半 */
        transform: translate(-50%, -50%);
        width: 277px;
        height: 297px;
        background-color: pink;
      }
    </style>
  </head>
  <body>
    <div class="box"></div>
  </body>
</html>
